/**
 * create by young (young2f@outlook.com) on 2020/12/4
 */
'use strict';
const model = require('../base/modelBase');
const _ = require('lodash');
module.exports = app => {
  const mongoose = app.mongoose;
  const schema = mongoose.Schema;
  const connect = app.mongooseDB.get('pmcBus');
  const json = {
    isEnabled: { type: 'boolean' },
    name: {
      type: 'string',
      inputType: 'input',
      desc: '名称',
      enableArea: [ 'table', 'input', 'detail', ],
      required: true
    },
    industry: {
      type: 'string',
      inputType: 'input',
      desc: '行业',
      enableArea: [ 'table', 'input', 'detail', ],
    },
    contactList: {
      type: 'array', inputType: 'input', desc: '联系列表', enableArea: [],
    },
    address: {
      type: 'string', inputType: 'input', desc: '地址', enableArea: [],
    },
    contacts: {
      type: 'string', inputType: 'input', desc: '联系人', enableArea: [],
    },
    contactsPhone: {
      type: 'string', inputType: 'input', desc: '联系人电话', enableArea: [],
    },
    fileList: { type: Array, _type: 'fileList', title: '图片列表' },
  };
  const _model = _.cloneDeep(model);
  _.assign(_model, json);
  const _schema = new schema(
    _model,
    { timestamps: { createdAt: 'createdTs', updatedAt: 'updatedTs' } }
  );
  _schema.index({ 'code': 1 });
  return connect.model('Customer', _schema);
};
/**
 current: { type: 'number' },
 voltage: { type: 'number' },
 activePower: { type: 'number' },
 positiveActiveEnergy: { type: 'number' },
 ReverseActiveEnergy: { type: 'number' },
 currentA: { type: 'number' },
 currentB: { type: 'number' },
 currentC: { type: 'number' },
 voltageA: { type: 'number' },
 voltageB: { type: 'number' },
 voltageC: { type: 'number' },
 */
